package com.jiawa.wiki.controller;

import com.jiawa.wiki.domain.Test;
import com.jiawa.wiki.service.TestService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class TestController {

    @Value("${test.hello}")
    public String testhello;


    @RequestMapping("/hello1")
    public String hello(){

        return "hello world"+testhello;
    }

    @PostMapping("/hello/post")
    public String post(String name){
        return "helloworld"+name;
    }

    //依赖注入
    @Resource
    public TestService testService;

    @GetMapping("/test/list")

    public List<Test> list(){
        return testService.list();

    }
}
